import request from '@/config/axios'

class User {
	register(data : any) : Ajax.PromiseAxiosResponse<any> {
		return request.post({
			url: '/user/register', data
		})
	}
	login(data : any) : Ajax.PromiseAxiosResponse<any> {
		return request.post({
			url: '/user/login', data
		})
	}
	updateUser(data : any) : Ajax.PromiseAxiosResponse<any> {
		return request.post({
			url: '/user/updateUser', data
		})
	}
	updateAvatar(avatar : any) : Ajax.PromiseAxiosResponse<any> {
		return request.post({
			url: '/user/updateAvatar?avatar=' + avatar
		})
	}
	updatePassword(data : any) : Ajax.PromiseAxiosResponse<any> {
		return request.post({
			url: '/user/updatePassword', data
		})
	}
	getActiveUser(data : any) : Ajax.PromiseAxiosResponse<any> {
		return request.get({
			url: '/user/getActiveUser', params:data
		})
	}
}

export const UserApi = new User()